package com.sharemarking.wa.platform.controller;

import com.sharemarking.wa.common.ResponseParams;
import com.sharemarking.wa.platform.service.OrderPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author dxy
 */
@RequestMapping("orderPay")
@Controller
public class OrderPayController {
    @Autowired
    OrderPayService orderPayService;

    /**
     * 微信支付
     * @return
     * @throws Exception
     */
    @PostMapping(value = "wxPay")
    @ResponseBody
    public ResponseParams<?> wxPay() throws Exception {
        return orderPayService.wxPay();
    }

    /**
     * 支付宝支付
     * @return
     * @throws Exception
     */
    @PostMapping(value = "alPay")
    @ResponseBody
    public ResponseParams<?> alPay() throws Exception {
        return orderPayService.alPay();
    }

    /**
     * 发布方支付
     * @return
     * @throws Exception
     */
    @PostMapping(value = "publisherPay")
    @ResponseBody
    public ResponseParams<?> publisherPay() throws Exception {
        return orderPayService.publisherPay();
    }

    /**
     * 获取费用
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getFees")
    @ResponseBody
    public ResponseParams<?> getFees() throws Exception {
        return orderPayService.getFees();
    }

    /**
     * 月结支付
     * @return
     * @throws Exception
     */
    @PostMapping(value = "monthPay")
    @ResponseBody
    public ResponseParams<?> monthPay() throws Exception {
        return orderPayService.monthPay();
    }


    /**
     * 是否月结
     * @return
     * @throws Exception
     */
    @PostMapping(value = "isMonthPay")
    @ResponseBody
    public ResponseParams<?> isMonthPay() throws Exception {
        return orderPayService.isMonthPay();
    }

    /**
     * 微信支付的回调接口
     * @return
     * @throws Exception
     */
    @PostMapping(value = "wxNotify")
    @ResponseBody
    public String wxNotify() throws Exception {
        return orderPayService.wxNotify();
    }

    /**
     * 支付宝支付的回调接口
     * @return
     * @throws Exception
     */
    @PostMapping(value = "zfbNotify")
    @ResponseBody
    public String zfbNotify() throws Exception {
        return orderPayService.zfbNotify();
    }


    /**
     * 获取微信支付二维码
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getWxPayCode")
    @ResponseBody
    public ResponseParams<?> getWxPayCode() throws Exception {
        return orderPayService.getWxPayCode();
    }


    /**
     * 获取支付宝支付二维码
     * @return
     * @throws Exception
     */
    @PostMapping(value = "getAlPayCode")
    public void getAlPayCode() throws Exception {
        orderPayService.getAlPayCode();
    }


    /**
     * 轮询是否交易成功
     * @return
     * @throws Exception
     */
    @PostMapping(value = "isPay")
    @ResponseBody
    public ResponseParams<?> isPay() throws Exception {
        return orderPayService.isPay();
    }


    /**
     * 是否有月结支付密码
     * @return
     * @throws Exception
     */
    @PostMapping(value = "isMonthPayPassword")
    @ResponseBody
    public ResponseParams<?> isMonthPayPassword() throws Exception {
        return orderPayService.isMonthPayPassword();
    }

}
